
var express = require('express');
var router = express.Router();

/* GET home page. */
router.get('/show', function(req, resp, next) {
    
    /* let my_method =req.query.callback;

    let my_method =req.query.callback;


    console.log("my_method===>>",my_method);
    
     resp.end(`${my_method}({"id":1,
                             "name":"test",
                              "classBean":{"id":1,"nane":"班级1"}
    })`)  */
    
     resp.json({"id":1,
             "name":"test",
              "classBean":{"id":1,"nane":"班级1"}
             })  
});
//登录
router.post("/login",(req,resp)=>{
    console.log("====<<<student")
    let  {username,pwd} =req.body;
    // console.log(req.query)
    if(username=='abc'&& pwd=='abc123'){
       resp.json({"code":1,"msg":"登录成功"});
    } 
    resp.json({"code":0,"msg":"用户名或者密码错误"}); 
});

router.get("/getstudent/:id",(req,resp)=>{
   
    let  {id} =req.params;
    resp.json({"id":id,"name":"cors"});
});


module.exports = router;
